package net.zoneland.knowledge.model;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import lombok.Data;
import net.zoneland.knowledge.utils.DateConverter;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;

import java.io.Serializable;
import java.util.Date;

/**
 * 第一议题.
 * @author zx
 */
@Data
public class DiYiYiTi implements Serializable {

    private static final long serialVersionUID = 8202786231543507986L;

//    @ExcelProperty(value = "序号", index = 0)
    @ExcelIgnore
    private String id;


    /**
     * 公司名称.
     */
    @ExcelProperty(value = "公司名称", index = 1)
    private String companyName;

    /**
     * 会议时间.
     */
    @ExcelProperty(value = {"会议时间"}, converter = DateConverter.class, index = 2)
    @DateTimeFormat("yyyy年MM月dd日")
    private Date meetingDate;

    /**
     * 学习内容.
     */
    @ExcelProperty(value = "学习内容", index = 3)
    private String learningContent;

    /**
     * 会议类别.
     */
    @ExcelProperty(value = "会议类别", index = 4)
    private String meetingType;

    /**
     * 会议名称.
     */
    @ExcelProperty(value = "会议名称", index = 5)
    private String meetingName;

    /**
     * 学习形式.
     */
    @ExcelProperty(value = "学习形式", index = 6)
    private String learningForm;

    /**
     * 参与人员.
     */
    @ExcelProperty(value = "参与人员", index = 7)
    private String meetingParticipant;

    /**
     * 请假.
     */
    @ExcelProperty(value = "请假", index = 8)
    private String meetingLeave;

    /**
     * 列席人员.
     */
    @ExcelProperty(value = "列席人员", index = 9)
    private String meetingAttend;

    /**
     * 部署：简报、信息.
     */
    @ExcelProperty(value = "部署：简报、信息", index = 10)
    private String meetingDeploy;

    /**
     * 单元格水平样式策略
     */
    public static HorizontalCellStyleStrategy  setHorizontalCellStyleStrategy(){
        // 头部样式
        WriteCellStyle headWriteCellStyle = new WriteCellStyle();

        WriteFont font = new WriteFont();
        font.setFontHeightInPoints((short)10);
        headWriteCellStyle.setWriteFont(font);

        // 内容样式
        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
        contentWriteCellStyle.setWrapped(true); // 数据超出换行
        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中
        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.LEFT); // 水平居中

        WriteFont contenFont = new WriteFont();
        contenFont.setFontHeightInPoints((short)8);
        contentWriteCellStyle.setWriteFont(contenFont);


        // 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现
        return new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
    }
}
